<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>评论管理</title>
    <meta name="author" content="SuggeElson"/>
    <meta name="description"
          content="Ycode admin template - new premium responsive admin template. This template is designed to help you build the site administration without losing valuable time.Template contains all the important functions which must have one backend system.Build on great twitter boostrap framework"/>
    <meta name="keywords"
          content="admin, admin template, admin theme, responsive, responsive admin, responsive admin template, responsive theme, themeforest, 960 grid system, grid, grid theme, liquid, masonry, jquery, administration, administration template, administration theme, mobile, touch , responsive layout, boostrap, twitter boostrap"/>
    <meta name="application-name" content="Ycode admin template"/>

    <!-- Mobile Specific Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <!-- Core stylesheets do not remove -->
    <link th:href="@{/lib/css/bootstrap/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/lib/css/bootstrap/bootstrap-responsive.min.css}" rel="stylesheet" type="text/css"/>
    <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
    <link th:href="@{/lib/css/supr-theme/jquery.ui.supr.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/lib/css/icons.css}" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" href="../../static/lib/css/datapicker/daterangepicker-bs3.css"
          th:href="@{/lib/css/datapicker/daterangepicker-bs3.css}"/>

    <!-- Plugin stylesheets -->
    <link th:href="@{/lib/plugins/misc/qtip/jquery.qtip.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/lib/plugins/forms/uniform/uniform.default.css}" type="text/css" rel="stylesheet"/>
    <link th:href="@{/lib/plugins/tables/dataTables/jquery.dataTables.css}" type="text/css" rel="stylesheet"/>

    <!-- Main stylesheets -->
    <link th:href="@{/lib/css/main.css}" rel="stylesheet" type="text/css"/>

    <!-- Custom stylesheets ( Put your own changes here ) -->
    <link th:href="@{/lib/css/custom.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/main.css}" rel="stylesheet" type="text/css"/>

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" th:href="@{/lib/images/favicon.ico}"/>
    <link rel="apple-touch-icon-precomposed" sizes="144x144"
          th:href="@{/lib/images/apple-touch-icon-144-precomposed.png}"/>
    <link rel="apple-touch-icon-precomposed" sizes="114x114"
          th:href="@{/lib/images/apple-touch-icon-114-precomposed.png}"/>
    <link rel="apple-touch-icon-precomposed" sizes="72x72"
          th:href="@{/lib/images/apple-touch-icon-72-precomposed.png}"/>
    <link rel="apple-touch-icon-precomposed" th:href="@{/lib/images/apple-touch-icon-57-precomposed.png}"/>

    <script type="text/javascript">
        //adding load class to body and hide page
        document.documentElement.className += 'loadstate';
    </script>

</head>

<body>
<!-- loading animation -->
<div id="qLoverlay"></div>
<div id="qLbar"></div>

<div id="header">

    <div class="navbar">
        <div class="navbar-inner">
            <div class="container-fluid">
                <a class="brand" href="user.html"><img src="http://source.ycode.cn/officalSite/images/icon-logo.png"
                                                       alt="Site2Images"/></a>
                <div class="nav-no-collapse">


                    <ul class="nav pull-right usernav">
                        <li><h3 class="marginT5">Welcome:</h3></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle avatar" data-toggle="dropdown">
                                <span class="icon16 icomoon-icon-user"></span>
                                <span class="txt">admin@Ycode.com</span>
                            </a>
                        </li>
                        <li><a href="index.html"><span class="icon16 icomoon-icon-exit"></span> Logout</a></li>
                    </ul>
                </div><!-- /.nav-collapse -->
            </div>
        </div><!-- /navbar-inner -->
    </div><!-- /navbar -->

</div><!-- End #header -->

<div id="wrapper">

    <!--Responsive navigation button-->
    <div class="resBtn">
        <a href="#"><span class="icon16 minia-icon-list-3"></span></a>
    </div>

    <!--Sidebar background-->
    <!--<div id="sidebarbg"></div>-->
    <!--Sidebar content-->

    <!--Body content-->
    <div id="" class="clearfix">
        <div class="contentwrapper"><!--Content wrapper-->

            <div class="heading">

                <h3>评论管理</h3>

            </div><!-- End .heading-->

            <div class="row-fluid">

                <div class="span12">

                    <div class="box gradient p-rel">

                        <div class="add-style">
                            <button class="query-btn fl" id="submitQuery" type="button">查询</button>
                            <button class="query-btn fl" id="back" type="button">返回</button>
                        </div>

                        <div class="title">
                            <h4>
                                <span>评价列表</span>
                            </h4>
                        </div>
                        <div class="content noPad clearfix">
                            <!--<form class="form-horizontal" action="/modelController/model_comment.html" id="searchForm"-->
                            <!--method="POST">-->
                            <!--<input type="hidden" id="myPage" name="pageNum" th:value="${pageNum}">-->
                            <!--<input type="hidden" name="pageSize" id="pageSize" th:value="${pageSize}">-->
                            <!--<input type="hidden" name="modelId" id="modelId" th:value="${modelId}">-->
                            <!--<div id="" class="dataTables_wrapper" role="grid">-->
                            <!--<div class="queryFrom">-->
                            <!--<label>评价时间:-->
                            <!--<input class="form-control active" id="searchTimeRange" readonly="" type="text">-->
                            <!--<input id="startDate" name="startDate" type="hidden">-->
                            <!--<input id="endDate" name="endDate" type="hidden">-->
                            <!--</label>-->
                            <!--</div>-->
                            <!--<div class="queryFrom">-->
                            <!--<div class="row-fluid">-->
                            <!--<label class="form-label span3 mt10" for="hangye">状态</label>-->
                            <!--<div class="span9 controls sel">-->
                            <!--<select class="nostyle required" id="hangye" name="hangye">-->
                            <!--<option value="">全部</option>-->
                            <!--<option value="">待回复</option>-->
                            <!--<option value="">已回复</option>-->
                            <!--</select>-->
                            <!--</div>-->
                            <!--</div>-->
                            <!--</div>-->
                            <!--</div>-->
                            <!--</form>-->
                            <form class="form-horizontal" action="/modelController/model_comment.html" id="searchForm"
                                  method="GET">
                                <input type="hidden" id="myPage" name="pageNum" th:value="${pageNum}">
                                <input type="hidden" name="pageSize" id="pageSize" th:value="${pageSize}">
                                <input type="hidden" name="modelId" id="modelId" th:value="${modelId}">
                                <table class="attr-table mt20">
                                    <input id="areaId" type="hidden" value="440100">
                                    <tbody>、
                                    <tr>
                                        <td>
                                            <label class="control-label">
                                                评价时间:
                                            </label>
                                            <input class="form-control active" id="commentTimeRange" readonly=""
                                                   type="text">
                                            <input id="startDate" name="startDate" type="hidden">
                                            <input id="endDate" name="endDate" type="hidden">
                                        </td>
                                        <td>
                                            <label class="control-label">状态:</label>
                                            <div class="dropdown-select fl">
                                                <select class="nostyle required" id="status" name="status">
                                                    <option value="">全部</option>
                                                    <option value="1">待回复</option>
                                                    <option value="2">已回复</option>
                                                </select>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </form>
                            <table cellpadding="0" cellspacing="0" border="0"
                                   class="responsive  display table  dataTable" width="100%"
                                   id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
                                <thead>
                                <tr role="row">
                                    <th class="sorting_asc" role="columnheader" tabindex="0"
                                        aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
                                        aria-sort="ascending" aria-label="模型编号: activate to sort column descending">
                                        评分
                                    </th>
                                    <th class="sorting" role="columnheader" tabindex="0"
                                        aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
                                        aria-label="模型名称: activate to sort column ascending">评价
                                    </th>
                                    <th class="sorting" role="columnheader" tabindex="0"
                                        aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
                                        aria-label="行业: activate to sort column ascending">评论人
                                    </th>
                                    <th class="sorting" role="columnheader" tabindex="0"
                                        aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
                                        aria-label="场景: activate to sort column ascending">状态
                                    </th>
                                    <th class="sorting" role="columnheader" tabindex="0"
                                        aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
                                        aria-label="上线状态: activate to sort column ascending">操作
                                    </th>
                                </tr>
                                </thead>

                                <tbody role="alert" aria-live="polite" aria-relevant="all" th:unless="${#lists.isEmpty(modelComment)}">
                                <tr th:each="comment: ${modelComment}" class="gradeX odd">
                                    <td th:text="${comment.score}"></td>
                                    <td><span th:text="${comment.content}"></span><br/><span style="color: red">回复：</span><span style="color: red" th:text="${comment.replyContent}"></span></td>
                                    <td th:text="${comment.evaluateUser}"></td>
                                    <td th:if="${comment.status}=='1'">待回复</td>
                                    <td th:if="${comment.status}=='2'">已回复</td>
                                    <td th:if="${comment.status}=='3'">已删除</td>
                                    <td class=" ">
                                        <a href="javascript:;" onclick="del(this)" th:value="${comment.id}" class="btn-success btn btn-mini">删除</a>
                                        <a href="javascript:;" onclick="reCommet(this)" th:value="${comment.id}" class="btn-success btn btn-mini">回复</a>
                                    </td>
                                </tr>
                                </tbody>
                                <tbody role="alert" aria-live="polite" aria-relevant="all" th:if="${#lists.isEmpty(modelComment)}">
                                <tr>
                                    <td colspan="5">没有符合查询条件的记录</td>
                                </tr>
                                </tbody>
                            </table>
                            <div class="dataTables_paginate paging_full_numbers" id="page">
                            </div>
                        </div>
                        <div id="myModal" class="modal hide fade" style="display: block;" aria-hidden="true">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"><span
                                        class="icon12 minia-icon-close"></span></button>
                                <h3>系统提示</h3>
                            </div>
                            <div class="modal-body">
                                <p>确定要删除吗？</p>
                            </div>

                            <div class="modal-footer">
                                <a href="#" class="btn" data-dismiss="modal">取消</a>
                                <a href="#" class="btn btn-danger">确认</a>
                            </div>
                        </div>
                        <div id="reComment" class="modal  " style="display: none;" aria-hidden="true">
                            <div class="modal-header">
                                <h3>回复</h3>
                            </div>
                            <div class="modal-body">
                                <textarea rows="5" cols="5" style="width: 100%" id="reCommentC"></textarea>
                            </div>
                        </div>
                    </div>

                </div><!-- End .box -->

            </div><!-- End .span12 -->

        </div><!-- End .row-fluid -->


    </div><!-- End contentwrapper -->
</div><!-- End #content -->

</div><!-- End #wrapper -->

<!-- Le javascript
================================================== -->
<!-- Important plugins put in all pages -->
<script type="text/javascript" th:src="@{/lib/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/js/bootstrap/bootstrap.js}"></script>
<script type="text/javascript" th:src="@{/lib/js/jquery.cookie.js}"></script>
<script type="text/javascript" th:src="@{/lib/js/jquery.mousewheel.js}"></script>

<!-- Charts plugins -->
<script type="text/javascript" src="plugins/charts/sparkline/jquery.sparkline.min.js"
        th:src="@{/lib/plugins/charts/sparkline/jquery.sparkline.min.js}"></script><!-- Sparkline plugin -->

<!-- Misc plugins -->
<script type="text/javascript" th:src="@{/lib/plugins/misc/qtip/jquery.qtip.min.js}"></script>
<!-- Custom tooltip plugin -->
<script type="text/javascript" th:src="@{/lib/plugins/misc/totop/jquery.ui.totop.min.js}"></script>

<!-- Search plugin -->
<script type="text/javascript" th:src="@{/lib/plugins/misc/search/tipuesearch_set.js}"></script>
<script type="text/javascript" th:src="@{/lib/plugins/misc/search/tipuesearch_data.js}"></script>
<!-- JSON for searched results -->
<script type="text/javascript" th:src="@{/lib/plugins/misc/search/tipuesearch.js}"></script>

<!-- Form plugins -->
<script type="text/javascript" th:src="@{/lib/plugins/forms/watermark/jquery.watermark.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/plugins/forms/uniform/jquery.uniform.min.js}"></script>

<!-- Fix plugins -->
<script type="text/javascript" th:src="@{/lib/plugins/fix/ios-fix/ios-orientationchange-fix.js}"></script>

<!-- Table plugins -->
<script type="text/javascript" th:src="@{/lib/plugins/tables/dataTables/jquery.dataTables.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/plugins/tables/responsive-tables/responsive-tables.js}"></script>
<!-- Make tables responsive -->

<!-- Important Place before main.js  -->
<script type="text/javascript" th:src="@{/lib/js/jquery-ui.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/plugins/fix/touch-punch/jquery.ui.touch-punch.min.js}"></script>
<!-- Unable touch for JQueryUI -->

<!-- Init plugins -->
<script type="text/javascript" th:src="@{/lib/js/main.js}"></script><!-- Core js functions -->
<script type="text/javascript" th:src="@{/lib/js/datatable.js}"></script><!-- Init plugins only for page -->


<script type="text/javascript" src="../../static/lib/js/commonAjax.js" th:src="@{/lib/js/commonAjax.js}"></script>

<!-- layer -->
<script type="text/javascript" th:src="@{/lib/layer/layer.js}"></script><!-- Core js functions -->
<script type="text/javascript" th:src="@{/lib/layPage/laypage.js}"></script><!-- Init plugins only for page -->
<script src="../../static/lib/dataPicker/moment.js" th:src="@{/lib/dataPicker/moment.js}"></script>
<script src="../../static/lib/dataPicker/daterangepicker.js" th:src="@{/lib/dataPicker/daterangepicker.js}"></script>

<script th:replace="fragments/siderBar-router :: siderBar"></script>
<script th:replace="fragments/login-filter :: header"></script>

<script th:inline="javascript">

    $('#commentTimeRange').daterangepicker();
    $('#commentTimeRange').on('apply.daterangepicker', function (ev, picker) {
        $("#startDate").val(picker.startDate.format('YYYY-MM-DD'));
        $("#endDate").val(picker.endDate.format('YYYY-MM-DD'));

    });

    $("#submitQuery").click(function () {
        $("#searchForm").submit();
    });
    $("#back").click(function () {
       window.history.back();
    });
   function reCommet(btn) {
       var commentId = $(btn).attr("value");

       layer.open({
           type: 1,
           title: '',
           btn: ['确定',"取消"],
           area: ['620px', '340px'],
           content:$('#reComment'),
           btn1: function (index) {
               var url = '/modelController/updataComment.do', isAdd = false;
               var reCommentC = $("#reCommentC").val();
               getHtmlByUrl({
                   url: url,
                   data: {id:commentId,reComment:reCommentC},
                   success: function (res) {
                      location.reload();
                   }
               });
           }
       });
   }
    function del(btn) {
        var commentId = $(btn).attr("value");
        layer.msg('你确要删除吗', {
            time: 0 //不自动关闭
            ,btn: ['确定', '取消']
            ,yes: function(index){
                layer.close(index);
                var url = '/modelController/updataComment.do', isAdd = false;
                var status = "3";
                getHtmlByUrl({
                    url: url,
                    data: {id:commentId,status:status},
                    success: function (res) {
                        location.reload();
                    }
                });
            }
        });
    }
    laypage({
        cont: 'page',
        pages: [[${totelPage}]], //通过后台拿到的总页数
        curr: [[${currentPage}]] || 1,
        first: '首页', //若不显示，设置false即可
        last: '尾页', //若不显示，设置false即可
        prev: '上一页', //若不显示，设置false即可
        next: '下一页', //若不显示，设置false即可
        jump: function (obj, first) { //触发分页后的回调
            if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
                $("#myPage").val(obj.curr);
                $("#searchForm").submit();
            }
        }
    });

</script>

</body>
</html>
